package com.tjetc.service.impl;

import com.tjetc.domain.Admin;
import com.tjetc.domain.OrderApproval;
import com.tjetc.mapper.OrderApprovalMapper;
import com.tjetc.service.OrderApprovalService;
import com.tjetc.utils.Db;
import com.tjetc.vo.Result;

import java.util.List;

public class OrderApprovalServiceImpl implements OrderApprovalService {
    private static OrderApprovalMapper orderApprovalMapper= Db.getMapper(OrderApprovalMapper.class);
    private Result result=new Result();

    @Override
    public List<OrderApproval> reviewed(Admin admin) {
        Integer adminId = admin.getAdminId();
        return orderApprovalMapper.reviewed(adminId);
    }

    @Override
    public Result insert(OrderApproval orderApproval) {
        try {
            int rows = orderApprovalMapper.insert(orderApproval);
            if (rows==1){
                return result.setCode(200).setMsg("审核成功");
            }else {
                return result.setCode(500).setMsg("审核失败");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result.setCode(500).setMsg("审核失败");
    }
}
